<template>
  <div class="choiceBank">
    <x-header :left-options="{backText: ''}">选择银行卡</x-header>
    <img src="../../assets/addSelect.png" alt="" width="20" class="fa r15 t15" @click="$router.push({path:'/main/addBank'})">
    <div class="bankSty mgT10">
      <div class="bg bankList pl15 bt" v-for="bank in bankList" @click="backBtn(bank.id)">
        <img :src="bank.url[3]" alt="" style="vertical-align: middle;" width="25">
        <span style="vertical-align: middle;">{{bank.name}}</span>
      </div>
    </div>
  </div>
</template>
<script>
  import { XHeader } from 'vux'
  import http from '../../service/http.js'
  export default {
    data() {
      return {
        bankList:[],
        status:''
      }
    },
    mounted(){
      this.status=location.hash.split("=")[1];
      this.getBankList();
    },
    methods: {
      getBankList() {
        http.get('/user/bank').then((res) => {
          if (res.status == 200) {
            this.bankList = res.data.body;
          }
        })
      },
      backBtn(id){
        if(this.status==1){
          location.hash="/main/rechargeCard?id="+id;
        } else if(this.status==2){
          location.hash="/main/putForward?id="+id;
        }
      }
    },
    components: {
      XHeader,
    }
  }
</script>
<style lang="less">
  body {
    background: #f6f6f6;
  }

  .choiceBank .vux-header {
    background: #fff;
  }

  .fa {
    position: absolute;
  }

  .r15 {
    right: 15px;
  }

  .t15 {
    top: 15px;
  }

  .mgT10 {
    margin-top: 10px;
  }

  .bg {
    background: #fff;
  }
  .pl15{
    padding-left: 15px;
  }
  .bt{
    border-bottom:1px solid #f6f6f6; 
  }
  .choiceBank .bankList {
    height: 50px;
    line-height: 50px;
  }

  .choiceBank .vux-header .vux-header-title {
    line-height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    color: #000;
  }

  .choiceBank .vux-header .vux-header-left .left-arrow:before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    border-width: 1px 0 0 1px;
    -webkit-transform: rotate(315deg);
    transform: rotate(315deg);
    top: 8px;
    left: 7px;
  }

  .addBankBox {
    background: #fff;
    margin-top: 10px;
  }

  .bankSty .bankSty {
    margin-top: 10px;
    position: relative;
  }

  .bankSty input {
    border: none;
    border-style: none;
    outline: none;
    position: absolute;
    right: 15px;
    text-align: right;
    display: inline-block;
    width: 70%;
    height: 40px;
    line-height: 40px;
  }

  .bankNumber {
    height: 40px;
    line-height: 40px;
    border-bottom: 1px solid #f6f6f6;
    padding-left: 15px;
    span {
      font-size: 16px;
    }
    .sendNumber {
      position: absolute;
      right: 15px;
      color: #fea620;
      font-size: 12px;
    }
  }
</style>